package com.andrew.service;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.andrew.dao.OrderDao;
import com.andrew.dao.impl.OrderDaoImpl;
import com.andrew.entity.Customer;
import com.andrew.entity.Order;
import com.andrew.entity.OrderBeanForAdmin;

public interface OrderService {
	/**
	 * 通过购物车添加订单与订单详情
	 * @param order
	 * @throws SQLException
	 */
	public abstract void addOrder(Order order);
	/**
	 * 获取我的订单
	 * @param customer
	 * @return
	 * @throws SQLException
	 */
	public abstract List<Order> getMyOrders(Customer customer) throws SQLException;
	
	/**
	 * 获取全部订单信息
	 * 给管理员使用
	 * @return
	 * @throws SQLException
	 */
	public abstract List<Order> getAllOrders() throws SQLException;
	/**
	 * 通过订单号获取订单信息
	 * @param orderNum
	 * @return
	 * @throws SQLException
	 */
	public abstract Order getOrderByOrderId(String orderId) throws SQLException;
	
	/***
	 * 更改订单状态
	 * @param orderId
	 * @param status
	 * @return
	 * @throws SQLException
	 */
	public int updateOrderStatus(String orderId,int status)throws SQLException;
	
	/**
	 * 购买，就是改变订单状态
	 * @param orderId
	 * @throws SQLException
	 */
	public void pay(String orderId) throws SQLException;
	
	/**
	 * 收货
	 * @param orderId
	 * @throws SQLException
	 */
	public void receiveGoods(String orderId)throws SQLException;
	
	/**
	 * 设置收货地址
	 * @param address
	 * @throws SQLException
	 */
	public void setAddress(String orderId,String address) throws SQLException;
	/**
	 * 更新订单详情
	 * @param orderId
	 * @param bookId
	 * @param newQuantity
	 */
	public abstract void updateOrderDetail(String orderId, int bookId, int newQuantity,HttpServletRequest req, HttpServletResponse resp) throws IOException;
	
}
